package com.dingding.service.activity.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.dingding.common.core.base.dto.ResponseEntity;
import com.dingding.common.core.beans.Activity;
import com.dingding.common.core.util.ToolUtil;
import com.dingding.facde.activity.dto.ExpiredCouponDTO;
import com.dingding.facde.activity.dto.shareplan.ResSharePlan;
import com.dingding.facde.activity.service.IActivityShowService;
import com.dingding.facde.coupon.ICouponService;
import com.dingding.service.activity.core.biz.IActivityListService;
import com.dingding.service.activity.core.biz.IActivityRelUserService;
import com.dingding.service.activity.core.biz.IActivityService;
import com.dingding.service.activity.core.biz.ISharePlanListService;
import com.dingding.service.activity.core.biz.IndexModuleListService;
import com.dingding.service.activity.core.dao.IActivityDao;
import com.dingding.service.activity.core.dao.IPromotionstatDao;

/**
 * @ClassName: ActivityServiceImpl
 * @Description: 活动模块的Service实现
 * @author yuHaiQing
 * @date 2016年3月24日 上午10:50:58
 */
@Component("activityShowService")
public class ActivityShowServiceImpl implements IActivityShowService {

	// 活动模块DAO对象
	@Resource(name = "activityDao")
	private IActivityDao activityDao;

	@Resource(name = "activityService")
	private IActivityService activityService;
	
	@Resource(name = "promotionstatDao")
	private IPromotionstatDao promotionstatDao;

	@Resource(name="activityRelUserService")
	private IActivityRelUserService activityRelUserService;
	
	@Resource(name = "activityListService")
	private IActivityListService activityListService;
	
	@Resource(name = "indexModuleListService")
	private IndexModuleListService indexModuleListService;
	
	@Resource(name = "sharePlanListService")
	private ISharePlanListService sharePlanListService;
	
	@Resource(name = "couponService")
	private ICouponService couponService;
	
	/**
	 * @Title: getActivityList
	 * @Description: 获取全部有效的活动列表
	 * @author yuHaiQing
	 * @return List<Systemnews>    返回类型
	 */
	@Override
	public List<Activity> getActivityList() {

		return activityDao.getActivityList();
	}

	
	/**
	 * @Title: getActivityInfo
	 * @Description: 根据活动Id获取活动详情
	 * @param  snId 活动Id
	 * @author yuHaiQing
	 * @return Systemnews    返回类型
	 */
	@Override
	public Activity getActivityInfo(String snId) {

		// 判断请求参数是否为空
		if (ToolUtil.isBlank(snId)) {
			return null;
		}

		return activityDao.getActivityInfo(snId);
	}

	
	/**
	 * @Title: resetInvalidActivity 
	 * @Description: 重置无效活动
	 * @author YHQ 
	 * @return boolean    true:重置成功   false:重置失败
	 */
	@Override
	public boolean resetInvalidActivity() {

		return activityService.resetInvalidActivity();
	}

	/**
	 * @Title: exchangeActivity 
	 * @Description: 兑换邀请码 
	 * @param userId 用户Id
	 * @param invitationCode 邀请码
	 * @author YHQ 
	 * @return Integer    返回类型
	 */
	@Override
	public Integer exchangeActivity(String userId, String invitationCode) {
		
		return activityRelUserService.exchangeActivity(userId, invitationCode);
	}


	/**
	 * @Description: 获取用户活动列表
	 * @author fengshuonan
	 * @return List<Activity> 活动列表
	 * @since 2.3.2
	 */
	@Override
	public String getActivityList(String clientData) {

		return this.activityListService.getActivityList(clientData);
	}


	/**
	 * @Description:获取首页的模块列表
	 * @author fengshuonan
	 * @since 2.4
	 */
	@Override
	public String getIndexModuleList(String clientData) {
		
		return this.indexModuleListService.getIndexModuleList(clientData);
	}

	/**
	 * @Description:获取首页的模块列表
	 * @author YHQ
	 * @since 2.5.4
	 */
	@Override
	public String getModuleList(String clientData) {
		
		return this.indexModuleListService.getModuleList(clientData);
	}

	/**
	 * @Description:获取共享计划列表
	 * @author fengshuonan
	 * @since 2.4
	 */
	@Override
	public ResponseEntity<ResSharePlan> getSharePlanList(String cityNo) {
		return this.sharePlanListService.getSharePlanList(cityNo);
	}


	/**
	 * 
	 * @Title: getExpiredCouponNumber 
	 * @Description: 获取即将过期优惠券数量
	 * @param userId 用户Id
	 * @author YHQ 
	 * @return ExpiredCouponDTO    返回类型
	 * 
	 */
	@Override
	public ExpiredCouponDTO getExpiredCouponNumber(String userId) {
		
		return couponService.getExpiredCouponNumber(userId);
	}

}
